﻿@model MyABP.Tasks.Dtos.CreateTaskInput

@{
    ViewBag.Title = "Create";
}
<div class="modal fade" id="add" tabindex="-1" role="dialog" aria-labelledby="createTask" data-backdrop="static">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">新建任务</h4>
            </div>
            <div class="modal-body" id="modalContent">

                @using (Ajax.BeginForm("Create", "Tasks", new AjaxOptions()
                {
                    UpdateTargetId = "taskList",
                    InsertionMode = InsertionMode.Replace,
                    OnBegin = "beginPost('#add')",
                    OnSuccess = "hideForm('#add')",
                    OnFailure = "errorPost(xhr, status, error,'#add')"
                }))
                {
                    @Html.AntiForgeryToken()
                <div class="form-horizontal">
                    <h4>发布任务</h4>
                    <hr />
                    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
                    <div class="form-group">
                        @Html.LabelFor(model => model.AssignedPersonId, "发布人", htmlAttributes: new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @Html.DropDownList("AssignedPersonId", ViewBag.AssignedPersonId as List<SelectListItem>, htmlAttributes: new { @class = "form-control" })
                            @Html.ValidationMessageFor(model => model.AssignedPersonId, "", new { @class = "text-danger" })
                        </div>
                    </div>
                    <br />
                    <br />
                    <div class="form-group">
                        @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
                            @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" })
                        </div>
                    </div>
                    <br />
                    <br />
                    <div class="form-group">
                        @Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } })
                            @Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" })
                        </div>
                    </div>
                    <br />
                    <br />
                    <div class="form-group">
                        @Html.LabelFor(model => model.State, htmlAttributes: new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @Html.EnumDropDownListFor(model => model.State, htmlAttributes: new { @class = "form-control" })
                            @Html.ValidationMessageFor(model => model.State, "", new { @class = "text-danger" })
                        </div>
                    </div>
                    <br />
                    <br />
                    <div class="form-group">
                        <div class="col-md-offset-2 col-md-10">
                            <button type="submit" class="btn btn-default">保存</button>
                        </div>
                    </div>
                </div>
                }
            </div>
        </div>
    </div>
</div>
